﻿#pragma once
#ifndef Logger_hpp
#define Logger_hpp

#include<cstdint>
#include<string>
#include<memory>
#include<vector>
#include"../Concurrency/SpinLock.hpp"
#include"Buffer.hpp"


namespace MMFLogger{

    class Logger
    {

        //这里主要做个双缓冲
        std::vector<Buffer*> mBuffers;

        //当前的缓冲
        int mCurBuffer;

        //自旋锁
        MMF::SpinLock mMutex;                      

    public:

        Logger();
        ~Logger();
        
        void PushLog(const std::string& log);
        void PushLog(const char* log, uint32_t size);
    };

}

#endif